/**
 * Created by ptt on 2016/5/27/0027.
 */ 
define(["../maintools/Controller.js", "../../gis/gis/loadMap.js"], function (Controller, map) {
	/*动画开始*/
	var loading = '<div class="spinner">'
				  +'<div class="spinner-container container1"><div class="circle1"></div>'
				  +'<div class="circle2"></div><div class="circle3"></div><div class="circle4"></div>'
				  +'</div>'
				  +'<div class="spinner-container container2"><div class="circle1"></div>'
				  +'<div class="circle2"></div><div class="circle3"></div><div class="circle4"></div>'
				  +'</div>'
				  +'<div class="spinner-container container3"><div class="circle1"></div>'
				  +'<div class="circle2"></div><div class="circle3"></div><div class="circle4"></div>'
				  +'</div>'
				  +'</div>';
	/*动画结束*/
	var date = $("#deta").html();
	$("#details").append(date);
	
	var nameUrl = $("#nameUrl").val();
	var trictUrl = $("#district").val();
	var codeUrl = $("#roadCode").val();
	var ajaxUrl = {
			"xmUrl":"/ssjc/tl/projects!findPlanPrearePoj.action?roadname="+nameUrl+"",
			"qqUrl":"/ssjc/tl/projects!findPrearePoj.action?roadname="+nameUrl+"",
			"zjUrl":"/ssjc/tl/projects!findProjectByName.action?roadname="+nameUrl+"",
			"cqUrl":"/ssjc/doc/docproject!gisDocProject.action?roadname="+nameUrl+"",
			"yhUrl":"/ssjc/tl/projects!findRoadInfoByRoad.action?roadname="+nameUrl+"&district="+trictUrl+"&roadCode="+codeUrl,
			"roadUrl":"/ssjc/tl/projects!findRoadBasicInfo.action?roadname="+nameUrl+"&district="+trictUrl+"&roadCode="+codeUrl,
			"xmIdUrl":"/ssjc/pl/planpreparepoj!getProjectById.action?id=",
			"qqIdUrl":"/ssjc/pre/preparepoj!getProjectById.action?id=",
			"yhIdUrl":"/ssjc/tl/projects!findYHInfo.action?roundId=",
			"zjIdUrl":"/ssjc/mp/project!getProjectById.action?id="
	};
	var mapData={
		plan:{
			dataType:"WFS",
			dataConfig:queryConfig.queryProject,
			projectType:"planproject",
			detailInfo:porjectConfig.planproject.detailUrl
		},
		ready:{
			dataType:"WFS",
			dataConfig:queryConfig.queryProject,
			projectType:"earlierproject",
			detailInfo:porjectConfig.earlierproject.detailUrl
		},
		construction:{
			dataType:"WFS",
			dataConfig:queryConfig.queryProject,
			projectType:"constructproject",
			detailInfo:porjectConfig.constructproject.detailUrl
		},
		curing:{
			dataType:"GEOJSON",
			dataConfig:{
				url:"/ssjc/rep/damagedisease!diseaseGeoJson.action?",
				queryFieldName:"id",
				nameFieldName:"roadName"
			},
			detailInfo:"/ssjc/pl/view/planproject!view.action?"
		}
	};
	function format(val){
		var time = val;
		var date = new Date(time);
		var year = date.getFullYear();
		var month = date.getMonth()+1;
		var day = date.getDate();
		time = year+"-"+month+"-"+day;
		return time;
	};
	/*-默认加载-*/
	//道路基本情况
	$.ajax({
		url:ajaxUrl.roadUrl,
		dataType:"json",
		type:'Get',
		beforeSend:function(){
			$("#outline .blurb").html("");
			$("#outline .blurb").append('<p>数据加载中...</p>');
			$("#outline .blurb p").css({"text-align":"center","line-height":"50px","color":"#3C8ADD"});
		},
		 complete:function(data){
				if(data.readyState==4){
			        var jsonData=JSON.parse(data.responseText);
					if(jsonData!=null&&jsonData.length!=0) {
						var route = jsonData.roadName.replace(/\s+/g,"");
						var road = Pengtu.buildCodeName(2050,jsonData.district).replace(/\s+/g,"");
						var starting = jsonData.startName.replace(/\s+/g,"");
						var end = jsonData.endName.replace(/\s+/g,"");
						$("#outline .blurb").html("");
						$("#outline .blurb").append(
							'<li><p class="title">路线名称：</p><p class="describe">' + route + '</p></li>'
							+ '<li><p class="title">道路位置：</p><p class="describe">' + road + '</p></li>'
							+ '<li><p class="title">起点名称：</p><p class="describe">' + starting + '</p></li>'
							+ '<li><p class="title">终点名称：</p><p class="describe">' + end + '</p></li>'
						);
						$("#outline .blurb").append('<div style="clear:both;"></div>');
					}else{
						$("#outline .blurb").html("");
						$("#outline .blurb").append('<p>道路基本情况&nbsp;&nbsp;&nbsp;暂无数据！</p>');
						$("#outline .blurb p").css({"text-align":"center","line-height":"50px","color":"orange"});
					}
			      }
				}
    });
	//项目规划
	$.ajax({
		url:ajaxUrl.xmUrl,
		dataType:"json",
		type:'Get',
		beforeSend:function(){
			$("#load .content .k").eq(0).show();
		},
		 complete:function(data){
				if(data.readyState==4){
			        var jsonData=JSON.parse(data.responseText);
			        if(jsonData.length==" "){
			        	$("#load .content .k").eq(0).addClass("fail");
			        	$("#load .content .k").eq(0).fadeOut(4500);
			        }else{
			        	$("#load .content .k").eq(0).addClass("Success");
			        	$("#load .content .k").eq(0).fadeOut(4500);
			        	$("#timeAxis .plan").addClass('zoomInRight');
			        	$("#timeAxis .plan").show();
			        }
			        for(var i=0;i<jsonData.length;i++){
			        $("#timeAxis .plan .rgt").append(
			        	'<li class="title" data-id="'+jsonData[i].id+'" data-mark="plan" data-code="'+i+'"><span class="list'+i+'">'+jsonData[i].projectName+'</span><i class="i png'+i+'"></i></li>'
			        	+'<li><span>'+jsonData[i].projectYear+'：项目年度'+'</span><i class="i d"></i></li>');
			        }
			        $("#timeAxis .plan .rgt").append('<div style="clear:both;"></div>');
			        $("#timeAxis .plan .rgt li.title").eq(0).addClass("bigTitle");
			        $("#timeAxis .plan .rgt li.title").eq(0).find("i").addClass("in");
			        ///////////
			        function auto(){
		    			var h = $(window).height();
		    			//赋值
		    			$("#timeAxis").height(h*0.99-125);
		    			$("#lifecycleContain").height(h*0.99);
		    			//样式
		    			$("#lifecycleContain").css({"margin-top":h*0.005+"px"});
		    		}auto();
				}
	        }
    });
    //前期项目
	$.ajax({
		url:ajaxUrl.qqUrl,
		dataType:"json",
		type:'Get',
		beforeSend:function(){
			$("#load .content .k").eq(1).show();
		},
		 complete:function(data){
				if(data.readyState==4){
			        var jsonData=JSON.parse(data.responseText);
			        if(jsonData.length==" "){
			        	$("#load .content .k").eq(1).addClass("fail");
			        	$("#load .content .k").eq(1).fadeOut(4500);
			        }else{
			        	$("#load .content .k").eq(1).addClass("Success");
			        	$("#load .content .k").eq(1).fadeOut(4500);
			        	$("#timeAxis .ready").addClass('zoomInRight');
			        	$("#timeAxis .ready").show();
			        }
			        for(var i=0;i<jsonData.length;i++){
			        $("#timeAxis .ready .rgt").append(
			        	'<li class="title" data-id="'+jsonData[i].id+'" data-mark="ready" data-code="'+i+'"><span class="list'+i+'">'+jsonData[i].projectName+'</span><i class="i png'+i+'"></i></li>');
			        	var josnLinks=jsonData[i].links;
			        	for(var j=0;j<josnLinks.length;j++){
			        		$("#timeAxis .ready .rgt").append('<li><span>'+josnLinks[j].date+'：'+josnLinks[j].content+'</span><i class="i d"></i></li>');
			        	}
			        }
			        $("#timeAxis .ready .rgt").append('<div style="clear:both;"></div>');
			        $("#timeAxis .ready .rgt li.title").eq(0).addClass("bigTitle");
			        $("#timeAxis .ready .rgt li.title").eq(0).find("i").addClass("in");
				}
	        }
    });
	//在建项目
	$.ajax({
		url:ajaxUrl.zjUrl,
		dataType:"json",
		type:'Get',
		beforeSend:function(){
			$("#load .content .k").eq(2).show();
		},
        complete:function(data){
			if(data.readyState==4){
		        var jsonData=JSON.parse(data.responseText);
		        if(jsonData.length==" "){
		        	$("#load .content .k").eq(2).addClass("fail");
		        	$("#load .content .k").eq(2).fadeOut(4500);
		        }else{
		        	$("#load .content .k").eq(2).addClass("Success");
		        	$("#load .content .k").eq(2).fadeOut(4500);
		        	$("#timeAxis .construction").show();
		        	$("#timeAxis .construction").addClass('zoomInRight');
		        }
		        for(var i=0;i<jsonData.length;i++){
		        $("#timeAxis .construction .rgt").append(
		        	'<li class="title" data-id="'+jsonData[i].id+'" data-mark="construction" data-code="'+i+'"><span class="list'+i+'">'+jsonData[i].projectName+'</span><i class="i png'+i+'"></i></li>');
			        var josnLinks=jsonData[i].links;
		        	for(var j=0;j<josnLinks.length;j++){
		        		$("#timeAxis .construction .rgt").append('<li><span>'+josnLinks[j].date+'：'+josnLinks[j].content+'</span><i class="i d"></i></li>');
		        	}	
		        }
		        $("#timeAxis .construction .rgt").append('<div style="clear:both;"></div>');
		        $("#timeAxis .construction .rgt li.title").eq(0).addClass("bigTitle");
		        $("#timeAxis .construction .rgt li.title").eq(0).find("i").addClass("in");
			}
        }
    });
	//产权档案
	$.ajax({
		url:ajaxUrl.cqUrl,
		dataType:"json",
		type:'Get',
		beforeSend:function(){
			$("#load .content .k").eq(3).show();
		},
        complete:function(data){
			if(data.readyState==4){
		        var jsonData=JSON.parse(data.responseText);
		        if(jsonData.length==" "){
		        	$("#load .content .k").eq(3).addClass("fail");
		        	$("#load .content .k").eq(3).fadeOut(4500);
		        }else{
		        	$("#load .content .k").eq(3).addClass("Success");
		        	$("#load .content .k").eq(3).fadeOut(4500);
		        	$("#timeAxis .property").show();
		        	$("#timeAxis .property").addClass('zoomInRight');
		        }
		        for(var i=0;i<jsonData.length;i++){
		        	var val = jsonData[i].year;
		        	if(val!="")
		        	$("#timeAxis .property .rgt").append('<li class="title" data-id="'+jsonData[i].id+'" data-mark="property" data-code="'+i+'"><span class="list'+i+'">'+jsonData[i].year+"："+jsonData[i].projectName+'</span><i class="i png'+i+'"></i></li>');
		        	
		        	if(val=="")
		        	$("#timeAxis .property .rgt").append('<li class="title" data-id="'+jsonData[i].id+'" data-mark="property" data-code="'+i+'"><span class="list'+i+'">'+jsonData[i].projectName+'</span><i class="i png'+i+'"></i></li>');
        			
        		}
		        $("#timeAxis .property .rgt").append('<div style="clear:both;"></div>');
		        $("#timeAxis .property .rgt li.title").eq(0).addClass("bigTitle");
		        $("#timeAxis .property .rgt li.title").eq(0).find("i").addClass("in");
			}
        }
    });
	//道路养护
	$.ajax({
		url:ajaxUrl.yhUrl,
		dataType:"json",
		type:'Get',
		beforeSend:function(){
			$("#load .content .k").eq(4).show();
		},
        complete:function(data){
			if(data.readyState==4){
		        var jsonData=JSON.parse(data.responseText);
		        if(jsonData.length==" "){
		        	$("#load .content .k").eq(4).addClass("fail");
		        	$("#load .content .k").eq(4).fadeOut(4500);
		        }else{
		        	$("#load .content .k").eq(4).addClass("Success");
		        	$("#load .content .k").eq(4).fadeOut(4500);
		        	$("#timeAxis .curing").addClass('zoomInRight');
		        	$("#timeAxis .curing").show();
		        }
		        for(var i=0;i<jsonData.length;i++){j=i+1;
			        
			        if(jsonData[i].num!=0){
			        	$("#timeAxis .curing .rgt").append(
		        			'<li data-judge="true" data-cid="'+jsonData[i].cid+'" data-id="'+jsonData[i].roundId+'" data-disease="'+jsonData[i].links[0]+'" data-maintain="'+jsonData[i].links[1]+'" data-modify="'+jsonData[i].links[2]+'" data-year="'+jsonData[i].mainyear+'" title="'+jsonData[i].mainyear+'：由'+jsonData[i].mainOrgName+'养护" class="title" data-mark="curing" data-code="'+i+'"><span class="list'+i+'">'+jsonData[i].mainyear+'：由'+jsonData[i].mainOrgName+'养护</span><i class="i png'+i+'"></i></li>'
				        	+'<li><span>'+jsonData[i].mainyear+'：共发现'+jsonData[i].links[0]+'个病害</span><i class="i d"></i></li>'
				        	+'<li><span>'+jsonData[i].mainyear+'：共处理'+jsonData[i].links[1]+'个保养</span><i class="i d"></i></li>'
				        	+'<li><span>'+jsonData[i].mainyear+'：共完成'+jsonData[i].links[2]+'次小修</span><i class="i d"></i></li>'
				        	+'<li><span>'+jsonData[i].mainyear+'：进行了路检</span><i class="i d"></i></li>'
			        	);
			        }else{
			        	$("#timeAxis .curing .rgt").append(
					        	'<li data-judge="false" data-cid="'+jsonData[i].cid+'" data-id="'+jsonData[i].roundId+'" data-disease="'+jsonData[i].links[0]+'" data-maintain="'+jsonData[i].links[1]+'" data-modify="'+jsonData[i].links[2]+'" data-year="'+jsonData[i].mainyear+'" title="'+jsonData[i].mainyear+'：由'+jsonData[i].mainOrgName+'养护" class="title" data-mark="curing" data-code="'+i+'"><span class="list'+i+'">'+jsonData[i].mainyear+'：由'+jsonData[i].mainOrgName+'养护</span><i class="i png'+i+'"></i></li>'
					        	+'<li><span>'+jsonData[i].mainyear+'：共发现'+jsonData[i].links[0]+'个病害</span><i class="i d"></i></li>'
					        	+'<li><span>'+jsonData[i].mainyear+'：共处理'+jsonData[i].links[1]+'个保养</span><i class="i d"></i></li>'
					        	+'<li><span>'+jsonData[i].mainyear+'：共完成'+jsonData[i].links[2]+'次小修</span><i class="i d"></i></li>'
					        );
			        }
			    }
		        $("#timeAxis .curing .rgt").append('<div style="clear:both;"></div>');
		        $("#timeAxis .curing .rgt li.title").eq(0).addClass("bigTitle").addClass("in");
		        $("#timeAxis .curing .rgt li.title").eq(0).find("i").addClass("in");
			}
        }
    });
    //initial searchbox has bug for global value jQuery
    Controller = Controller.Controller;
    map = map.map;
	queryToLocation(nameUrl);

    var data = {
        value: "",
        query: "",
        roadName: "民治大道"
    };
    var legendData = [
        {
            src: "/ssjc/images/gis/disease.png",
            color: "",
            text: "道路病害"
        },
        {
            src: "/ssjc/images/gis/maintain.png",
            color: "",
            text: "道路保养"
        },
        {
            src: "/ssjc/images/gis/minorrepair.png",
            color: "",
            text: "道路小修"
        }
    ];
    var stack = [];
    var query ={};
    var renderData;
    var phaseMapUrl = {
        "规划": "http://218.17.162.92:9898/geoserver/szroad/wfs?",
        "前期": "/ssjc/pre/preparepoj!findPPForMap.action?",
        "施工": "/ssjc/mp/project!getByName.action?",
        "养护": "/ssjc/rep/damagedisease!diseaseGeoJson.action?"
    };
	var titleClicked=false;
    var Life = Controller.create({
        elements: {
           // "div.main": "mainDiv"
        },
        events: {
            "click div.main p": "open",
            "click div.content":"viewDetails",
            "click #timeAxis .rgt li.title":"callData",
        },
        viewDetails:function(e){
			if(titleClicked)
			{
				titleClicked=false;
				return ;
			}
        	var selectNum =  e.currentTarget.dataset.index;
        	$("#details").removeClass("box_dowm").addClass("box_hide");
        	setTimeout(function(){
        		$("#details").removeClass("box_up");
        		$("#details .column").removeClass("color");
        		$("#details .content").removeClass("height");
        		$("#details .column li").removeClass("cur");
        	},450);
        	$("#timeAxis .content li.title span").removeClass("on");
        	$("#timeAxis .content li.title i").removeClass("dh");
        	$("#timeAxis .content").eq(selectNum).find(".lft").addClass("on").parent().siblings().find(".lft").removeClass("on");
        	$("#timeAxis .content").eq(selectNum).find(".rgt").addClass("on").parent().siblings().find(".rgt").removeClass("on");
        	$("#timeAxis .content").eq(selectNum).find(".rgt li").addClass("on").parent().parent().siblings().find(".rgt li").removeClass("on");
        	$("#timeAxis .content").eq(selectNum).find(".rgt li i").addClass("on").parent().parent().parent().siblings().find(".rgt li i").removeClass("on");
        	$("#timeAxis .content").eq(selectNum).find(".rgt li.title").addClass("on").parent().parent().siblings().find(".rgt li.title").removeClass("on");
        	$("#timeAxis .content").eq(selectNum).find(".rgt li.title i").addClass("on").parent().parent().parent().siblings().find(".rgt li.title i").removeClass("on");
        	$("#timeAxis .content").eq(selectNum).siblings().find("li.title span").removeClass("on");
        	$("#timeAxis .content").eq(selectNum).siblings().find("li.title i").removeClass("dh");
			var titleNodes=e.currentTarget.getElementsByClassName("title");
			var projectIds=[];
			var projectType;
			if(titleNodes.length>0)
			{
				for(var i=0;i<titleNodes.length;i++){
					var tempNode=titleNodes[i];
					if(tempNode.hasAttribute("data-id"))
					{
						projectIds.push(tempNode.getAttribute("data-id"));
					}
					if(tempNode.hasAttribute("data-mark"))projectType=tempNode.getAttribute("data-mark")
				}
			}
			queryMapToLocation(projectType,projectIds,true);
        },
        callData:function(e){
        	$("#details .content #paging").hide();
        	var selectNum = e.currentTarget.parentNode.parentNode.dataset.index;
        	$("#timeAxis .content").eq(selectNum).find(".lft").addClass("on").parent().siblings().find(".lft").removeClass("on");
        	$("#timeAxis .content").eq(selectNum).find(".rgt").addClass("on").parent().siblings().find(".rgt").removeClass("on");
        	$("#timeAxis .content").eq(selectNum).find(".rgt li").addClass("on").parent().parent().siblings().find(".rgt li").removeClass("on");
        	$("#timeAxis .content").eq(selectNum).find(".rgt li i").addClass("on").parent().parent().parent().siblings().find(".rgt li i").removeClass("on");
        	$("#timeAxis .content").eq(selectNum).find(".rgt li.title").addClass("on").parent().parent().siblings().find(".rgt li.title").removeClass("on");
        	$("#timeAxis .content").eq(selectNum).find(".rgt li.title i").addClass("on").parent().parent().parent().siblings().find(".rgt li.title i").removeClass("on");
        	$("#timeAxis .content").eq(selectNum).siblings().find("li.title span").removeClass("on");
        	var num =  e.currentTarget.dataset.code;
        	var mark =  e.currentTarget.dataset.mark;
        	var year =  e.currentTarget.dataset.year;
        	var disease = e.currentTarget.dataset.disease;
        	var maintain = e.currentTarget.dataset.maintain;
        	var modify = e.currentTarget.dataset.modify;
        	var id =  e.currentTarget.dataset.id;
        	var cid =  e.currentTarget.dataset.cid;
        	var judge = e.currentTarget.dataset.judge;
        	$("#timeAxis ."+mark+" li.title .list"+num+"").addClass("on").parent().siblings().find("span").removeClass("on");
        	$("#timeAxis ."+mark+" li.title .png"+num+"").addClass("dh").parent().siblings().find("i").removeClass("dh");
        	$("#timeAxis ."+mark+"").siblings().find("li.title span").removeClass("on");
        	$("#timeAxis ."+mark+"").siblings().find("li.title i").removeClass("dh");
        	$("#details .column").css({"height":"auto"});
        	switch(mark){
        		case "plan":
        			$("#details .column").html(" ");
        			$("#details .column").append('<li class="on">规划项目</li>');
	        		$.ajax({url:ajaxUrl.xmIdUrl+id,dataType:"json",type:'Get',
	            		beforeSend:function(){
	            			$("#details .content .demo").html(" ");
	            			$("#details .content .demo").html(loading);
	            			$("#details").removeClass("box_hide").removeClass("box_up").addClass("box_dowm");
	            			$("#details .content .demo").removeClass("w_auto").addClass("w_fixed");
	            			$("#details .column").removeClass("color");
	            			$("#details .content").removeClass("height");
	            			$("#details .column li").removeClass("cur");
	            		},
	            		 complete:function(data){
            				if(data.readyState==4){
            			        var jsonData=JSON.parse(data.responseText);
            			        function tim(){
            			        setTimeout(function(){
        			        		$("#details .content .demo").html(" ");
            			        	$("#details .content .demo").append(getHtml(mark,jsonData));
            			        	$("#details").removeClass("box_hide").removeClass("box_dowm").addClass("box_up");
	        			        	$("#details .content .demo").removeClass("w_fixed").addClass("w_auto");
            			        },500);}tim();}
            	            }
	                });
        		break;
        		case "ready":
        			$("#details .column").html("");
        			$("#details .column").append('<li class="on">前期项目</li>');
	        		$.ajax({url:ajaxUrl.qqIdUrl+id,dataType:"json",type:'Get',
	            		beforeSend:function(){
	            			$("#details .content .demo").html(" ");
	            			$("#details .content .demo").html(loading);
	            			$("#details").removeClass("box_hide").removeClass("box_up").addClass("box_dowm");
	            			$("#details .content .demo").removeClass("w_auto").addClass("w_fixed");
	            			$("#details .column").removeClass("color");
	            			$("#details .content").removeClass("height");
	            			$("#details .column li").removeClass("cur");
	            		},
	            		complete:function(data){
	            			if(data.readyState==4){
	        			        var jsonData=JSON.parse(data.responseText);
	        			        function tim(){
	    			        	setTimeout(function(){
	    			        		$("#details .content .demo").html(" ");
	        			        	$("#details .content .demo").append(getHtml(mark,jsonData));
	        			        	$("#details").removeClass("box_hide").removeClass("box_dowm").addClass("box_up");
	        			        	$("#details .content .demo").removeClass("w_fixed").addClass("w_auto");
	    			        	},500);}tim();}
	            	        }
	                });
        		break;
        		case "construction":
	    			$("#details .column").html("");
	    			$("#details .column").append('<li class="on">在建项目</li>');
	        		$.ajax({url:ajaxUrl.zjIdUrl+id,dataType:"json",type:'Get',
	            		beforeSend:function(){
	            			$("#details .content .demo").html(" ");
	            			$("#details .content .demo").html(loading);
	            			$("#details").removeClass("box_hide").removeClass("box_up").addClass("box_dowm");
	            			$("#details .content .demo").removeClass("w_auto").addClass("w_fixed");
	            			$("#details .column").removeClass("color");
	            			$("#details .content").removeClass("height");
	            			$("#details .column li").removeClass("cur");
	            		},
	            		complete:function(data){
	        				if(data.readyState==4){
	        			        var jsonData=JSON.parse(data.responseText);
	        			        function tim(){
	        			            setTimeout(function(){
	        			            	$("#details .content .demo").html(" ");
	            			        	$("#details .content .demo").append(getHtml(mark,jsonData));
	            			        	$("#details").removeClass("box_hide").removeClass("box_dowm").addClass("box_up");
	            			        	$("#details .content .demo").removeClass("w_fixed").addClass("w_auto");
	        			        },500);}tim();
	        				}
	            	     }
	                });
        		break;
        		case "property":
        			$("#details .column").html("");
        			$("#details .column").append('<li class="on">产权档案</li>');
            		$.ajax({url:ajaxUrl.cqUrl,dataType:"json",type:'Get',
                		beforeSend:function(){
                			$("#details .content .demo").html(" ");
                			$("#details .content .demo").html(loading);
                			$("#details").removeClass("box_hide").removeClass("box_up").addClass("box_dowm");
                			$("#details .content .demo").removeClass("w_auto").addClass("w_fixed");
                			$("#details .column").removeClass("color");
                			$("#details .content").removeClass("height");
                			$("#details .column li").removeClass("cur");
                		},
                		complete:function(data){
                				if(data.readyState==4){
                			        var jsonData=JSON.parse(data.responseText);
                					var val = jsonData[num].archiveCatalogs.length;
                			        function tim(){
                			            setTimeout(function(){
                			            	$("#details .content .demo").html("");
                    			        	$("#details .content .demo").append(getHtml(mark,jsonData[num]));
                    			        	if(val != 0){
                    			        	$("#details .content .demo").append('<li class="txt">工程清单</li>');
                        			        	  for(var i=0;i<val;i++){
                        			        		$("#details .content .demo").append(
  	                                    			'<li><div class="name">案卷名：</div><div class="value"><a target="_blank" href="'+curingData[mark].dataQuery.pdfUrl+jsonData[num].archiveCatalogs[i].catalogNum+'">'+jsonData[num].archiveCatalogs[i].projName+'</a></div><div style="clear:both;"></div></li>'
  	                            	        		+'<li><div class="name">卷号：</div><div class="value">'+jsonData[num].archiveCatalogs[i].catalogNum+'</div><div style="clear:both;"></div></li>'
  	                            	        		+'<li style="width:95%;margin:5px auto;border-bottom:1px solid #EFEFEF;"></li>'
                        			        		);
                        			        	  }
                          					}
                      			        	$("#details").removeClass("box_hide").removeClass("box_dowm").addClass("box_up");
                    			        	$("#details .content .demo").removeClass("w_fixed").addClass("w_auto");
                			       },500);}tim();}
                	    }
                    });
            	break;
        		case "curing":
	        		var Url = ajaxUrl.yhIdUrl+id+"&cid="+cid;
	    			$("#details .column").html(" ");
		        	$("#details .column").append(
		        			'<li data-If="true" data-cid="'+cid+'" data-id="'+id+'" data-year="'+year+'" data-mark="curing" data-code="0" class="on">养护</li>'
		        			+'<li data-If="true" data-cid="'+cid+'" data-id="'+id+'" data-num="'+disease+'" data-year="'+year+'" data-mark="disease" data-code="1">病害</li>'
		        			+'<li data-If="true" data-cid="'+cid+'" data-id="'+id+'" data-num="'+maintain+'" data-year="'+year+'" data-mark="maintain" data-code="2">保养</li>'
		        			+'<li data-If="true" data-cid="'+cid+'" data-id="'+id+'" data-num="'+modify+'" data-year="'+year+'" data-mark="modify" data-code="3">小修</li>'
		        			+'<li data-If="true" data-judge="'+judge+'" data-cid="'+cid+'" data-id="'+id+'" data-year="'+year+'" data-mark="checkpoint" data-code="4">路检</li>'
		        	);
	    			$.ajax({url:Url,dataType:"json",type:'Get',
	            		beforeSend:function(){
	            			$("#details .content .demo").html(" ");
	            			$("#details .content .demo").html(loading);
	            			$("#details").removeClass("box_hide").removeClass("box_up").addClass("box_dowm");
                			$("#details .content .demo").removeClass("w_auto").addClass("w_fixed");
                			$("#details .column").addClass("color");
                			$("#details .content").addClass("height");
                			$("#details .content .demo .spinner").addClass("cen");
                			$("#details .column li").addClass("cur");
	            		},
	            		complete:function(data){
            				if(data.readyState==4){
            			        var jsonData=JSON.parse(data.responseText);
            			        function tim(){
            			            setTimeout(function(){
            			            	$("#details .content .demo").html(" ");
                			        	$("#details .content .demo").append(getHtml(mark,jsonData));
                			        	if(jsonData.type==1){
            			            		$("#details .content li").eq(1).find(".value").html("公路");
            			            	}else if(jsonData.type==2){
            			            		$("#details .content li").eq(1).find(".value").html("市政道路");
            			            	}
                			        	$("#details").removeClass("box_hide").removeClass("box_dowm").addClass("box_up");
                			        	$("#details .content .demo").removeClass("w_fixed").addClass("w_auto");
                			        	$("#details .content .demo .spinner").removeClass("cen");
            			        },500);}tim();}
            	            }
	                });
    			break;
        		default:;
        	}
			//地图查询定位
			queryMapToLocation(mark,[id],false);
			titleClicked=true;
        },
        template: "#tlifeMain",
        jrt: function () {var that = this;},
        open: function (e) {}
    });
    
    function getHtml(mark,data,time){
    	var html = "";
    	switch (mark){
    		case "plan":
    			html = 
    			'<li><div class="name">项目名称：</div><div class="value">'+data.projectName+'</div><div style="clear:both;"></div></li>'
        		+'<li><div class="name">项目类型：</div><div class="value">'+Pengtu.buildCodeName(2045,data.projectType)+'</div><div style="clear:both;"></div></li>'
        		+'<li><div class="name">工程位置：</div><div class="value">'+data.projectLocation+'</div><div style="clear:both;"></div></li>'
        		+'<li><div class="name">区：</div><div class="value">'+Pengtu.buildCodeName(2050,data.district)+'</div><div style="clear:both;"></div></li>'
        		+'<li><div class="name">街道：</div><div class="value">'+data.subDistrict+'</div><div style="clear:both;"></div></li>'
        		+'<li><div class="name">建设规模：</div><div class="value">'+data.projectService+'</div><div style="clear:both;"></div></li>'
        		+'<li><div class="name">建设性质：</div><div class="value">'+Pengtu.buildCodeName(3008,data.buildKind)+'</div><div style="clear:both;"></div></li>'
        		+'<li><div class="name">项目概括：</div><div class="value">'+data.projectPoint+'</div><div style="clear:both;"></div></li>'
				+'<li><div class="name">详细信息：</div><a href='+mapData[mark].detailInfo+data.id+' target="_blank">详细信息</a><div style="clear:both;"></div></li>';
    			break;
    		case "ready":
    			html =
    				'<li class="txt">基本信息</li>'
        			+'<li><div class="name">项目名称：</div><div class="value valu">'+data.projectName+'</div></li>'
	        		+'<li><div class="name">项目编号：</div><div class="value valu">'+data.projectCode+'</div><div style="clear:both;"></div></li>'
	        		+'<li><div class="name">项目类型：</div><div class="value valu">'+Pengtu.buildCodeName(2045,data.projectType)+'</div></li>'
	        		+'<li><div class="name">项目年度：</div><div class="value valu">'+data.projectYear+'</div><div style="clear:both;"></div></li>'
        			+'<li class="txt">项目概况</li>'
        			+'<li><div class="name">辖区局：</div><div class="value valu">'+data.signOrg+'</div></li>'
	        		+'<li><div class="name">街道：</div><div class="value valu">'+data.subDistrict+'</div><div style="clear:both;"></div></li>'
	        		+'<li><div class="name">建设性质：</div><div class="value valu">'+Pengtu.buildCodeName(3008,data.buildKind)+'</div><div style="clear:both;"></div></li>'
	        		+'<li><div class="name">项目概括：</div><div class="value">'+data.projectPoint+'</div><div style="clear:both;"></div></li>'
	        		+'<li><div class="name">建设规模：</div><div class="value">'+data.projectService+'</div><div style="clear:both;"></div></li>'
        			+'<li class="txt">项目投资</li>'
        			+'<li><div class="name">资金来源：</div><div class="value valu">'+Pengtu.buildCodeName(2002,data.maintainSource)+'</div></li>'
	        		+'<li><div class="name">总投资：</div><div class="value valu">'+data.projectCost+'万</div><div style="clear:both;"></div></li>'
	        		+'<li><div class="name">近期投资：</div><div class="value valu">'+data.recentCost+'万</div><div style="clear:both;"></div></li>'
        			+'<li class="txt">项目进度</li>'
	        		+'<li><div class="name">项目阶段：</div><div class="value valu">'+Pengtu.buildCodeName(2040,data.projectStep)+'</div></li>'
	        		+'<li><div class="name">开始时间：</div><div class="value valu">'+data.planBeginDate+'</div><div style="clear:both;"></div></li>'
	        		+'<li><div class="name">结束时间：</div><div class="value valu">'+data.planEndDate+'</div></li>'
	        		+'<li><div class="name">进度要求：</div><div class="value valu">'+data.cuSchedule+'</div><div style="clear:both;"></div></li>'
	        		+'<li><div class="name">实际进度：</div><div class="value valu">'+data.nowSchedule+'</div><div style="clear:both;"></div></li>'
	        		+'<li><div class="name">备注：</div><div class="value">'+data.remark+'</div><div style="clear:both;"></div></li>'
					+'<li><div class="name">详细信息：</div><a href='+mapData[mark].detailInfo+data.id+' target="_blank">详细信息</a><div style="clear:both;"></div></li>';
    			break;
    		case "construction":
    			html =
    				'<li class="txt">基本信息</li>'
        			+'<li><div class="name">项目名称：</div><div class="value valu">'+data.projectName+'</div></li>'
	        		+'<li><div class="name">项目编号：</div><div class="value valu">'+data.projectCode+'</div><div style="clear:both;"></div></li>'
	        		+'<li><div class="name">项目类型：</div><div class="value valu">'+Pengtu.buildCodeName(2045,data.projectType)+'</div></li>'
	        		+'<li><div class="name">项目年度：</div><div class="value valu">'+data.projectYear+'</div><div style="clear:both;"></div></li>'
        			+'<li class="txt">项目概况</li>'
        			+'<li><div class="name">办事处：</div><div class="value valu">'+data.subDistrict+'</div></li>'
	        		+'<li><div class="name">建设性质：</div><div class="value valu">'+Pengtu.buildCodeName(3008,data.buildKind)+'</div><div style="clear:both;"></div></li>'
	        		+'<li><div class="name">建设内容：</div><div class="value">'+data.projectPoint+'</div><div style="clear:both;"></div></li>'
	        		+'<li><div class="name">项目来源：</div><div class="value">'+data.projectSource+'</div><div style="clear:both;"></div></li>'
	        		+'<li><div class="name">建设规模：</div><div class="value">'+data.projectService+'</div><div style="clear:both;"></div></li>'
        			+'<li class="txt">参建单位</li>'
        			+'<li><div class="name">责任单位：</div><div class="value valu">'+data.dutyOrg+'</div></li>'
	        		+'<li><div class="name">建设单位：</div><div class="value valu">'+data.signOrg+'</div><div style="clear:both;"></div></li>'
	        		+'<li><div class="name">施工单位：</div><div class="value valu">'+data.mainOrg+'</div></li>'
	        		+'<li><div class="name">设计单位：</div><div class="value valu">'+data.designOrg+'</div><div style="clear:both;"></div></li>'
	        		+'<li><div class="name">监理单位：</div><div class="value valu">'+data.supOrg+'</div></li>'
	        		+'<li><div class="name">资金来源：</div><div class="value valu">'+Pengtu.buildCodeName(2002,data.maintainSource)+'</div><div style="clear:both;"></div></li>'
	        		+'<li class="txt">项目资金</li>'
        			+'<li><div class="name">总投资：</div><div class="value valu">'+data.projectCost+'万</div></li>'
	        		+'<li><div class="name">建安费：</div><div class="value valu">'+data.installationCost+'万</div><div style="clear:both;"></div></li>'
	        		+'<li class="txt">项目进度</li>'
	        		+'<li><div class="name">计划开始：</div><div class="value valu">'+data.planBeginDate+'</div></li>'
	        		+'<li><div class="name">计划结束：</div><div class="value valu">'+data.planEndDate+'</div><div style="clear:both;"></div></li>'
	        		+'<li><div class="name">实际开始：</div><div class="value valu">'+data.beginDate+'</div></li>'
	        		+'<li><div class="name">实际结束：</div><div class="value valu">'+data.endDate+'</div><div style="clear:both;"></div></li>'
	        		+'<li><div class="name">备注：</div><div class="value">'+data.remark+'</div><div style="clear:both;"></div></li>'
					+'<li><div class="name">详细信息：</div><a href='+mapData[mark].detailInfo+data.id+' target="_blank">详细信息</a><div style="clear:both;"></div></li>';
    			break;
    		case "property":
    			html =
    				'<li class="txt">基本信息</li>'
        			+'<li><div class="name">项目名称：</div><div class="value">'+data.projectName+'</div><div style="clear:both;"></div></li>'
	        		+'<li><div class="name">建设单位：</div><div class="value">'+data.signOrg+'</div><div style="clear:both;"></div></li>'
	        		+'<li><div class="name">施工单位：</div><div class="value">'+data.mainOrg+'</div><div style="clear:both;"></div></li>'
	        		+'<li><div class="name">设计单位：</div><div class="value">'+data.disignOrg+'</div><div style="clear:both;"></div></li>'
	        		+'<li><div class="name">监理单位：</div><div class="value">'+data.supOrg+'</div><div style="clear:both;"></div></li>'
	        		+'<li><div class="name">开工时间：</div><div class="value valu">'+data.beginDate+'</div></li>'
	        		+'<li><div class="name" style="width:100px;">交竣工时间：</div><div class="value valu">'+data.endDate+'</div><div style="clear:both;"></div></li>';
	        	break;
    		case "curing":
    			html =
    				'<li class="txt">基本信息</li>'
        			+'<li><div class="name"> 道路类型：</div><div class="value valu">'+data.type+'</div><div style="clear:both;"></div></li>'
        			+'<li><div class="name"> 道路全称：</div><div class="value">'+data.roadName+'</div><div style="clear:both;"></div></li>'
        			+'<li><div class="name"> 起点：</div><div class="value valu">'+data.startName+'</div></li>'
        			+'<li><div class="name"> 终点：</div><div class="value valu">'+data.endName+'</div><div style="clear:both;"></div></li>'
        			+'<li><div class="name"> 养护标段：</div><div class="value valu">'+data.mainDistrict+'</div></li>'
        			+'<li><div class="name"> 区：</div><div class="value valu">'+data.area+'</div><div style="clear:both;"></div></li>'
        			+'<li><div class="name"> 街道：</div><div class="value valu">'+data.districtNum+'</div><div style="clear:both;"></div></li>'
        			+'<li><div class="name"> 管养单位：</div><div class="value">'+data.manageOrg+'</div><div style="clear:both;"></div></li>'
        			+'<li><div class="name"> 养护单位：</div><div class="value">'+data.maintainOrg+'</div><div style="clear:both;"></div></li>'
        			+'<li><div class="name"> 监管单位：</div><div class="value">'+data.supervisionOrg+'</div><div style="clear:both;"></div></li>';
        		break;
    		default:;
    	}
    	return html;
    };
   var lifeTrigger = new Life("#lifecycleContain");

      lifeTrigger.render([]);
	//高亮符号
	var hightimage = new ol.style.Icon({
		src: "/ssjc/images/gis/label-hong.png",
		scale: 0.8
	});
	var hightLightStyles = {
		'Point': new ol.style.Style({
			image: hightimage
		}),
		'LineString': new ol.style.Style({
			stroke: new ol.style.Stroke({
				color: '#00FFFF',
				width: 4
			})
		}),
		'MultiLineString': new ol.style.Style({
			stroke: new ol.style.Stroke({
				color: '#00FFFF',
				width: 4
			})
		}),
		'Polygon': new ol.style.Style({
			stroke: new ol.style.Stroke({
				color: '#00FFFF',
				lineDash: [4],
				width: 4
			}),
			fill: new ol.style.Fill({
				color: 'rgba(0, 0, 255, 0.1)'
			})
		})
	};
	var HightLightstyleFunction = function(feature) {
		return hightLightStyles[feature.getGeometry().getType()];
	};
	//基础符号
	var image = new ol.style.Icon({
		src: "/ssjc/images/gis/label-lan.png",
		scale: 0.8
	});
	var styles = {
		'Point': new ol.style.Style({
			image: image
		}),
		'LineString': new ol.style.Style({
			stroke: new ol.style.Stroke({
				color: '#CD00CD',
				width: 4
			})
		}),
		'MultiLineString': new ol.style.Style({
			stroke: new ol.style.Stroke({
				color: '#CD00CD',
				width: 4
			})
		}),
		'Polygon': new ol.style.Style({
			stroke: new ol.style.Stroke({
				color: 'blue',
				lineDash: [4],
				width: 4
			}),
			fill: new ol.style.Fill({
				color: 'rgba(0, 0, 255, 0.1)'
			})
		})
	};
	var styleFunction = function(feature) {
		return styles[feature.getGeometry().getType()];
	};
	//加载WFS服务，并提供定位功能
    function queryMapToLocation(projectType,projectIds,islike) {
		m_reMoveLayerAndolay();
		var projectData=mapData[projectType];
		if(!projectData) return;
		switch(projectData.dataType){
			case"WFS":
				var queryData=projectData.dataConfig;
				var f = ol.format.ogc.filter;
				var featureRequest = new ol.format.WFS().writeGetFeature({
					srsName: 'EPSG:4326',
					featureNS: queryData.featureNS,
					featurePrefix: queryData.featurePrefix,
					featureTypes: queryData.layers,
					outputFormat: 'application/json',
					filter: islike?f.and(f.equalTo(queryData.classFieldName, projectData.projectType),f.like(queryData.nameFieldName,'*'+nameUrl+'*')):f.and(f.equalTo(queryData.classFieldName, projectData.projectType),f.equalTo(queryData.queryFieldName,projectIds[0]))
				});
				fetch(queryData.url, {
					method: 'POST',
					body: new XMLSerializer().serializeToString(featureRequest)
				}).then(function(response) {
					return response.json();
				}).then(function(json) {
					var features = new ol.format.GeoJSON().readFeatures(json,{dataProjection: "EPSG:4326", featureProjection: "EPSG:3857"});
					if (features.length > 0) {
						var detailSource = new ol.source.Vector();
						var detailLayer = new ol.layer.Vector({
							source: detailSource,
							style: styleFunction
						});
						detailSource.addFeatures(features);
						//结果定位
						if(features.length>0){
							map.getView().fit(detailSource.getExtent(),map.getSize(),{padding: [170, 50, 30, 150]});
						}
						m_TempLayer = detailLayer;
						map.addLayer(detailLayer);
					}
				});
				break;
			case"GEOJSON":
				var queryWhere=islike?projectData.dataConfig.nameFieldName+"="+nameUrl:projectData.dataConfig.queryFieldName+" = "+projectIds[0];
				if(!projectIds[0])
				{
					queryWhere=projectData.dataConfig.nameFieldName+"="+nameUrl;
				}
				var dataUrl=projectData.dataConfig.url+queryWhere
				$.get(dataUrl).
				then(function(response){
					var format = new ol.format.GeoJSON();
					var features;
					var detailSource = new ol.source.Vector();
					var detailLayer = new ol.layer.Vector({
						source: detailSource,
						style: styleFunction
					});
					features=format.readFeatures(response, {featureProjection: 'EPSG:3857'});
					detailSource.addFeatures(features);
					//结果定位
					if(features.length>0){
						map.getView().fit(detailSource.getExtent(),map.getSize(),{padding: [170, 50, 30, 150]});
					}
					m_TempLayer = detailLayer;
					map.addLayer(detailLayer);
				});
				break;
		}

		var selectPointerMove = new ol.interaction.Select({
			condition: ol.events.condition.pointerMove
		});
		map.addInteraction(selectPointerMove);
		var pre;
		selectPointerMove.on("select", function(e) {
			var hit = !!e.target.getFeatures().getLength();
			map.getTargetElement().style.cursor = hit ? 'pointer' : 'default';
			if (hit) {
				pre && pre.setStyle(styleFunction(pre));
				pre = e.target.getFeatures().array_[0];
				pre.setStyle(HightLightstyleFunction(pre));
			} else {
				if(pre&&styleFunction) {
					pre.setStyle(styleFunction(pre));
				}
			}
		});

		map.on('click', queryFun);
	};
	function hoverFeature(e) {
		if (e.dragging) {
			return;
		}
		var pixel = map.getEventPixel(e.originalEvent);
		var hit = map.hasFeatureAtPixel(pixel);
		map.getTargetElement().style.cursor = hit ? 'pointer' : 'default';
	};
	function queryFun(e) {
		var pixel = map.getEventPixel(e.originalEvent);
		var featureInfo = map.forEachFeatureAtPixel(pixel,
			function (feature, layer) {
				return {feature:feature,layer:layer};
			});
		if (featureInfo!==undefined&&featureInfo!==null
			&&featureInfo.layer!==null&&featureInfo.layer.getKeys().indexOf("layername")<0)
		{
			//console.log(featureInfo.layer);
			var overlay = new ol.Overlay({
				element: document.getElementById("overlay"),
				positioning: "bottom-center"
			});
			map.addOverlay(overlay);
			var element = overlay.getElement();
			$(element).addClass("detail");
			$(element).find(".ocontent").empty();
			if(featureInfo.feature.getKeys().indexOf("projectname")>0) {
				$(element).find(".ohead p").html(featureInfo.feature.getProperties()["projectname"]);
				var Featureproperties=featureInfo.feature.getProperties();
				var fprojectType=Featureproperties["projecttype"];
				//获取项目详情信息并展示
				var InfoUrl=porjectConfig.projectInfo.detailUrl;
				InfoUrl+="id="+Featureproperties["projectid"]+"&projecttype="+fprojectType;
				$.get(InfoUrl).then(function (response) {
					if(response){
						for(var key in response) {
							var  titleStr=Pengtu.buildCodeName("7778", key);
							if(titleStr!=key) {
								$("<p>").text(titleStr + ": " + response[key]).appendTo($(element).find(".ocontent"));
							}
						}
					}
					$("<p>").text("项目详情: ").append($("<a>").text("查看详情").attr({
						"href": porjectConfig[fprojectType].detailUrl + featureInfo.feature.getProperties()["projectid"],
						"target": "_blank"
					})).appendTo($(element).find(".ocontent"));
					$(element).data("query", overlay);
					overlay.setPosition(e.coordinate);
				});
			}
			else if(featureInfo.feature.getKeys().indexOf("type")>0){
				if(featureInfo.feature.getKeys().indexOf("landmark")>0) {
					$(element).find(".ohead p").html(featureInfo.feature.getProperties()["landmark"]);
				}
				else {
					$(element).find(".ohead p").html(featureInfo.feature.getProperties()["projectName"]);
				}
				//添加养护概要信息
				var property = featureInfo.feature.getProperties();
				for (var key in property) {
					if (typeof property[key] === "string" && key !== "landmark" && key.indexOf("id")<0&&key!="caseNo"&&key.indexOf("Id")<0&&key!="type"&& key !== "projectName")
						$("<p>").text(Pengtu.buildCodeName("7777", key)+ ": " + property[key]).appendTo($(element).find(".ocontent"));
				}
				var featureDataType=property["type"];
				if(featureDataType) {
					var Detailurl;
					switch (featureDataType) {
						case "disease": //病害
							Detailurl=curingData.disease.dataQuery.detailUrl;
							Detailurl+= property["caseNo"]?property["caseNo"]:property["id"];
							$("<p>").text("详细信息:").append($("<a>").text("查看详情").attr({
								"href": Detailurl,
								"target": "_blank"
							})).appendTo($(element).find(".ocontent"));
							$(element).data("query", overlay);
							break;
						case"roadFit"://保养
							Detailurl=curingData.maintain.dataQuery.detailUrl;
							Detailurl+=property["rtId"]?property["rtId"]:property["id"];
							$("<p>").text("详细信息:").append($("<a>").text("查看详情").attr({
								"href": Detailurl,
								"target": "_blank"
							})).appendTo($(element).find(".ocontent"));
							$(element).data("query", overlay);
							break;
						case "repair"://小修
							Detailurl=curingData.modify.dataQuery.sbUrl;
							Detailurl+=property["rrId"]?property["rrId"]:property["id"];
							$("<p>").text("申报表:").append($("<a>").text("查看申报表").attr({
								"href": Detailurl,
								"target": "_blank"
							})).appendTo($(element).find(".ocontent"));
							$("<p>").text("  验收表:").append($("<a>").text("查看验收表").attr({
								"href": Detailurl,
								"target": "_blank"
							})).appendTo($(element).find(".ocontent"));
							$(element).data("query", overlay);
							break;
					}
					$(element).data("query", overlay);
					overlay.setPosition(e.coordinate);
				}
			}
			else{
				$(element).find(".ohead p").html(featureInfo.feature.getId());
				$(element).data("query", overlay);
				overlay.setPosition(e.coordinate);
			}

		}
		else
		{
			var olay = $("#overlay").data("query");
			olay && olay.setPosition([9999, 9999]);
		}
	};
    //初始化定位
	function queryToLocation (roadname) {
			m_reMoveLayerAndolay();
		if(roadname){
			var f = ol.format.ogc.filter;
			var featureRequest = new ol.format.WFS().writeGetFeature({
				srsName: 'EPSG:4326',
				featureNS: queryConfig.queryRoad.featureNS,
				featurePrefix: queryConfig.queryRoad.featurePrefix,
				featureTypes: queryConfig.queryRoad.layers,
				outputFormat: 'application/json',
				filter: f.equalTo(queryConfig.queryRoad.nameFieldName, roadname)
			});
			// post请求，并根据请求的数据进行加载
			fetch(queryConfig.queryRoad.url, {
				method: 'POST',
				body: new XMLSerializer().serializeToString(featureRequest)
			}).then(function(response) {
				return response.json();
			}).then(function(json) {
				var source = new ol.source.Vector();
				var layer = new ol.layer.Vector({
					source: source,
					style:styleFunction
				});
				var features = new ol.format.GeoJSON().readFeatures(json,{featureProjection: 'EPSG:3857',dataProjection:"EPSG:4326"});
				if(features.length>0) {
					source.addFeatures(features);
					map.getView().fit(source.getExtent(), (map.getSize()));
				}
				//m_TempLayer=layer;
				layer.set("layername","roadname");
				map.addLayer(layer);
			});

		}
	};
	
});
